package xj.model.uml;

public class DataType extends NamedElement {

  public DataType() {
    this(null);
  }

  public DataType(String name) {
    super(name);
    destructable = false;
    preserved = true;
  }

  public DataType(String name, Visibility visibility) {
    super(name, visibility);
    destructable = false;
    preserved = true;
  }

  @Override
  public Object clone() throws CloneNotSupportedException {
    DataType ne = (DataType) super.clone();
    ne.setName(name);
    return ne;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o instanceof DataType) {
      DataType e = (DataType) o;
      if (name == null) {
	return (e.name == null);
      } else {
	return name.equals(e.name);
      }
    }
    return false;
  }

  @Override
  public int hashCode() {
    int c = 0;
    if (name != null) {
      c += name.hashCode();
    }
    return c;
  }


}
